package net.xuhf.exception;

import cn.dev33.satoken.exception.NotLoginException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@ControllerAdvice
@ResponseBody
public class GlobalExceptionHandler {

    @ExceptionHandler(value = NotLoginException.class) //该注解声明异常处理方法
    public String exceptionHandler(HttpServletRequest request, Exception e) {
        return "用户未登录";
    }
}
